package com.ht.medicaltreatment.viewmodel

import androidx.lifecycle.viewModelScope
import com.ht.medicaltreatment.bean.OrderList96Bean
import com.xgst.lib.http.ApiResult
import kotlinx.coroutines.launch

class OrderList96ViewModel : BaseViewModel() {
    fun orderList(onSuccess:(MutableList<OrderList96Bean>?)->Unit, onError:(String)->Unit){
        viewModelScope.launch {
            val bean = mApi.orderList96()
            when(bean){
                is ApiResult.Success -> onSuccess(bean.data.data)
                is ApiResult.Error -> onError(bean.errorMessage)
            }
        }
    }
}
